<html>
	<head>
		<title>Home - BigQuery Endpoint</title>
		<link type="text/css" rel="stylesheet" href="/css/style.css" />
		<script type="text/javascript" src="/js/jquery-1.4.2.min.js"></script>
		<script type="text/javascript" src="/js/bqs.js"></script>
	</head>
<body>
	<div id="menu">{{ menu }}</div>
	<div id="currentuser">{{ cuser }}</div>
	
	<div id="header">
		<a href="/" title="Home" class="home">BigQuery Endpoint</a>
	</div>

	<div id="main">
		<h2>Execute Query</h2>
		<div id="queryf">
			<form id="querfform" action="/execq" method="post">
				<fieldset>
					<legend>Query</legend>
					<textarea class="qin" id="querystr" name="querystr" rows="4" cols="40">{{ querystring }}</textarea>
					<div id="notequery">
						Currently, only <code>SELECT</code> queries in <a href="https://code.google.com/apis/bigquery/docs/query-reference.html" target="_new">BigQuery's SQL dialect</a> are supported. I plan to add a support for on-the-fly SPARQL-to-SQL rewrite soon (as well as output in SPARQL result format). Note also the default table schema: <span id="schemehintcontrol">view ...</span>
					</div>
					<label>Description</label><br />
						<input type="input" id="qdesc" size="80" value="" />
					<div class="cmd">
						<input id="execq" type="submit" value="Execute" /> <button id="saveq">Save</button>
					</div>
					<div id="schemehint">The default table <code>[lodcloud/rdftable]</code> has the following schema:
<pre> +--------------------------------------------------------+
 | graph_uri | subject | predicate | object | object_type |
 +--------------------------------------------------------+
 | ...       | ...     | ...       | ...    | ...         |</pre>
						Read more about the data representation in the respective <a href="/about#tn_import">about section</a> ...
					</div>
				</fieldset>
			</form>
			<div id="result">
				{% if hasresults %}
					<fieldset>
						<legend>Result</legend>
						{{ queryresults }}
					</fieldset>
				{% endif %}
			</div>
		</div>
		{% if hassqueries %}
		<div id="qlcontrol"></div>
		<h2 id="querylisthead">Query Library</h2>
		<div id="querylist">
			<div id="queryfilter">Filter by (<em>case sensitive</em>): <input id="filterq" size="50" /> <img src="/img/reset.png" id="resetfilter" alt="reset" title="reset filter"/></div>
			{% for bquery in bqueries %}
				{{ bquery }}
			{% endfor %}
		</div>
		{% endif %}
	</div>

	<div id="footer">{{ footer }}</div>
</body>
</html>